using System;

namespace RPGLibrary.ItemClasses
{
    public class Shield : BaseItem
    {
        public int DefenseValue { get; protected set; }
        public int DefenseModifier { get; protected set; }

        public Shield(
            string shieldName, 
            string shieldType, 
            int price, 
            float weight, 
            int defenseValue, 
            int defenseModifier,
            string[] allowableClasses)
            : base(shieldName, shieldType, price, weight, allowableClasses)
        {
            DefenseValue = defenseValue;
            DefenseModifier = defenseModifier;
        }

        public override object Clone()
        {
            string[] allowedClasses = new string[allowableClasses.Count];

            for (int i = 0; i < allowableClasses.Count; i++)
            {
                allowedClasses[i] = allowableClasses[i];
            }

            Shield shield = new Shield(
                Name,
                Type,
                Price,
                Weight,
                DefenseValue,
                DefenseModifier,
                allowedClasses);

            return shield;
        }

        public override string ToString()
        {
            string shieldString = base.ToString() + ", ";
            shieldString += DefenseValue.ToString() + ", ";
            shieldString += DefenseModifier.ToString();

            foreach (string s in allowableClasses)
            {
                shieldString += ", " + s;
            }

            return shieldString;
        }
    }
}